/**
 * 
 * 用户相关的api接口: 用户登录 获取用户信息 修改密码 退出登录
 * 
 */
//1. 引入request文件
import request from "../utils/request";

//2. 登录接口
let doLogin = (username, password) =>{ 

   return request({
        url: "/user/login",
        method : "POST",
        data : {
            username,
            password
        }
    })
}

//3. 用户信息接口
let doUserInfo = () => {
    return request({
        url: "/user/info",
        method : "GET"
    })
}

//4. 退出登录接口
let doLogout = ()=>{
    return request({
        url : "/user/logout",
        method : "POST"
    })
}

//5. 校验原密码接口
let doVerifyPass = (userId,password) => {
    return request({
        url : "/user/pwd",
        method : "POST",
        data : {
            userId,
            password
        }
    })
}

//6. 修改密码接口
let doChangePass = (userId,pass) => {
    return request({
        url : "/user/pwd",
        method : "PUT",
        data : {
            userId,
            pass,
        }
    })
}

//导出封装的接口
export default { 
    doLogin,
    doUserInfo,
    doLogout,
    doVerifyPass,
    doChangePass
}
